package com.kaishengit.web;

import java.io.IOException;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class HelloServlet extends HttpServlet {

	private static final long serialVersionUID = 1L;
	
	
	public HelloServlet(){
		System.out.println("create HelloServlet.......................");
	}

	/*@Override
	public void init() throws ServletException {
		
		ServletConfig config = getServletConfig();
		String email = config.getInitParameter("email");
		
		System.out.println("init............................." + email);
	}*/
	
	@Override
	public void init(ServletConfig config) throws ServletException {
		String email = config.getInitParameter("email");
		System.out.println("init............................." + email);
	}
	
	@Override
	public void destroy() {
		System.out.println("destroy...................................");
	}
	
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		
		System.out.println("doGet.....................................");
		
/*		PrintWriter out = response.getWriter();
		out.print("<html>");
		out.print("<head><title>Hello</title></head>");
		out.print("<body>");
		for(int i = 0;i< 20;i++){
			out.print("<div style=\"color:red;font-size:24px\">Hello,Servlet!</div>");
		}
		out.print("</body>");
		out.print("</html>");
		
		out.flush();
		out.close();*/
		
		
	}
	
}
